% cover-lulu-quarto.tex

% make a cover PDF for lulu.com's Crown Quarto booksize.

% note: Lulu will flatten this PDF and get the colors wrong. Convert
% this PDF to PNG first (eg, using GIMP: just import at 300dpi then
% export as PNG).

\documentclass{memoir}
\usepackage[sfdefault]{universalis}
\usepackage[osf]{Baskervaldx} % oldstyle figures

\newcommand{\olpath}{../../}

\usepackage[absolute,overlay]{textpos}
\usepackage{rotating}
\usepackage{forallxyyc}

\colorlet{leadbeater}{darkred}

% lulu.com's instructions:
% Spine width: 50.27 Postscript points wide (1.773 cm) (209 px)
% Spine begins 545 Postscript points (19.224 cm) (2271 px) from the left.
% Total cover width: 1140.27 X 715 Postscript points (40.221 cm X 25.220 cm) (4751px X 2979px)

\newlength{\coverheight}
\newlength{\coverwidth}
\newlength{\spinewidth}
\newlength{\spinepos} % spine starts here, width = \spinewidth
\newlength{\coverpos} % front cover starts here, width = \spinepos

\setlength{\coverheight}{715bp}
\setlength{\coverwidth}{1140.27bp}
\setlength{\spinewidth}{50.27bp}
\setlength{\spinepos}{545bp}

% \coverpos = \spinepso + \spinewidth
\setlength{\coverpos}{\spinepos}
\addtolength{\coverpos}{\spinewidth}

% set stock size to total width & height of cover 
\setstocksize{\coverheight}{\coverwidth}

% pagesize = stocksize
\settrimmedsize{\stockheight}{\stockwidth}{*}
\settrims{0pt}{0pt}

% no margins or headers
\setlrmarginsandblock{0pt}{0pt}{*}
\setheadfoot{0pt}{0pt}
\setulmarginsandblock{0pt}{0pt}{*}
\setheadfoot{0pt}{0pt}
\setlength{\headsep}{0pt}


% finalize the page layout
\checkandfixthelayout[fixed]
\typeoutlayout

\color{black}

\begin{document}
% no folios
\pagestyle{empty}

% set back background to Matt's orange

\pagecolor{leadbeater}

% make a spine
\begin{textblock*}{\spinewidth}(\spinepos,0bp)%
\noindent\hfil\rotatebox{-90}{% make spine text readable when book is lying cover up
      \hbox to \coverheight{\hfil
          \huge\sffamily\bfseries\color{white}
            forall \textit{x}: An Introduction to Formal Logic\hfil \forallxshortversion\hspace{2cm}}}\hfil
\end{textblock*}
\newbox\adjust
% make front cover
\begin{textblock*}{\spinepos}(\coverpos,0pt)
  \noindent\hfil
  \begin{minipage}[b][\coverheight][s]{.8\spinepos}\color{white}
\vspace*{3cm}
    \noindent {\fontsize{46pt}{0pt}\selectfont forall $x$}

\

\noindent{\Huge{Calgary Remix}}

\vspace*{1cm}
\noindent{\huge \emph{An Introduction to Formal Logic}}

\vfill
\noindent{\fontsize{16pt}{18pt}\selectfont \textbf{P.~D. Magnus}\\
  \textbf{Tim Button}\\
  \textit{with additions by}\\
  \textbf{J.~Robert Loftis}\\ \textit{remixed and revised by}\\
  \textbf{Aaron Thomas-Bolduc}\\ \textbf{Richard Zach}\par}
\vfill
\noindent
\includegraphics[width=1cm]{assets/cc.pdf}
\includegraphics[width=1cm]{assets/by.pdf}
\includegraphics[width=1cm]{assets/remix.pdf}
\hfill \vbox to 1cm{\vfill\hbox{\LARGE \forallxversion}\vfill}
\vspace{2cm}
  \end{minipage}
  \hfil
  \end{textblock*}

% make back cover
\begin{textblock*}{\spinepos}(0pt,0pt)
  \noindent\hspace{1.5cm}
  \begin{minipage}[b][\coverheight][b]{.85\spinepos}
\begin{minipage}[b]{2.5cm}
\includegraphics[width=1.2cm]{assets/cc.pdf}
\includegraphics[width=1.2cm]{assets/by.pdf}
\includegraphics[width=1.2cm]{assets/remix.pdf}
\end{minipage}
\hspace{.3cm}
\begin{minipage}[b]{4.7cm}
  \fontsize{11pt}{1.2em}\selectfont\color{white}\textit{forall x:
    Calgary Remix} by P.~D. Magnus et al.\ is licensed under a
  Creative Commons Attribution 4.0 International License.

\end{minipage}
\hfill\color{black}
\colorbox{white}{\includegraphics{isbn_barcode.pdf}}

\vspace*{2cm}
  \end{minipage}
  \hfill
\end{textblock*}

\end{document}
